credit1: Make weight per-vcpu
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 13 Aug 2010 07:33:19 +0000 (08:33 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 13 Aug 2010 07:33:19 +0000 (08:33 +0100)
commit3a37d430ce266c8ec742a0075cd4a76e358c6a04
tree49902481532fbf25c579d4bc04ca4d92eb4d0042
parente53dc1608f9528b2db5abd8c786d46cd93a24c4d
credit1: Make weight per-vcpu

Change the meaning of credit1's "weight" parameter to be per-vcpu,
rather than per-VM.

At the moment, the "weight" parameter for a VM is set on a per-VM
basis.  This means that when cpu time is scarce, two VMs with the same
weight will be given the same amount of total cpu time, no matter how
many vcpus it has.  I.e., if a VM has 1 vcpu, that vcpu will get x% of
cpu time; if a VM has 2 vcpus, each vcpu will get (x/2)% of the cpu
time.

I believe this is a counter-intuitive interface.  Users often choose
to add vcpus; when they do so, it's with the expectation that a VM
will need and use more cpu time.  In my experience, however, users
rarely change the weight parameter.  So the normal course of events is
for a user to decide a VM needs more processing power, add more cpus,
but doesn't change the weight.  The VM still gets the same amount of
cpu time, but less efficiently allocated (because it's divided).

The attached patch changes the meaning of the "weight" parameter, to
be per-vcpu.  Each vcpu is given the weight.  So if you add an extra
vcpu, your VM will get more cpu time as well.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/common/sched_credit.c